//
//  ParticleScene.m
//  ProjectLila
//
//  Created by Tedo on 6/25/10.
//  Copyright 2010 sushigames. All rights reserved.
//

#import "ParticleScene.h"
#import "MainMenuScene.h"

@implementation ParticleLayer

- (id) init {
	self = [super init];
	if (self) {
		CCQuadParticleSystem *emitter = [CCQuadParticleSystem particleWithFile:@"particle_sun.plist"];
		[self addChild:emitter];
		
		CGSize size = [[CCDirector sharedDirector] winSize];
		[emitter setPosition:ccp( size.width/2, size.height/2 )];
		
		// exit button
		[CCMenuItemFont setFontSize:24];
        [CCMenuItemFont setFontName:@"Verdana"];
        CCMenuItem *exit = [CCMenuItemFont itemFromString:@"Exit"
													   target:self
												 selector:@selector(exit:)];
        CCMenu *menu = [CCMenu menuWithItems:exit, nil];
		[menu setPosition:ccp( size.width/10, size.height/10 )];
		[self addChild:menu];
	}
	return self;
}

- (void)exit:(id)sender {
	[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:0.5f scene:[MainMenuScene scene]]];
}

@end


@implementation ParticleScene

+ (id) scene {
	ParticleScene *scene = [ParticleScene node];
	[scene addChild:[ParticleLayer node]];
	
	return scene;
}

@end
